package com.asianrapid.service.impl.sys;

import com.asianrapid.dao.CarsDao;
import com.asianrapid.model.sys.CarsAndCtypeEntity;
import com.asianrapid.model.sys.CarsEntity;
import com.asianrapid.model.sys.CtypeEntity;
import com.asianrapid.service.sys.CarsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CarsServiceImpl implements CarsService {
    @Autowired
    private CarsDao carsDao;

    @Override
    public List<CarsAndCtypeEntity> carsList(int pageSize, int start) {
        int state = 0;
        return carsDao.carsList( pageSize,  start, state);
    }

    @Override
    public int carsSize( int pageSize, int start) {
        int state = 0;
        return carsDao.carsSize( pageSize, start, state);
    }


    @Override
    public void insertCars(CarsEntity carsEntity) {
        carsEntity.setState(0);
        carsDao.insertCars(carsEntity);
    }


    @Override
    public List<CtypeEntity> getCarType() {

        return carsDao.getCarType();
    }

    @Override
    public void updateCars(CarsEntity carsEntity) {

        carsDao.updateCars(carsEntity);
    }


    @Override
    public void deleteCars(List<String> groupId) {

        carsDao.updateDeleteCars(groupId);
    }

    @Override
    public CarsEntity getCars(Integer groupId) {


        return carsDao.getCars(groupId);
    }
}
